<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://java.sun.com/jsf/composite"
      xmlns:f="http://java.sun.com/jsf/core">
    <!-- INTERFACE -->
    <composite:interface>

        <composite:attribute name="cliente" required="true"/>
        <composite:attribute name="buttonText" required="true" default="Criar"/>
        <composite:attribute name="onclick_button_update" />
        <composite:attribute name="onclick_sair_javascript" />
        <composite:attribute name="buttonAction" required="true"
                             method-signature="java.lang.String action()"/>
    </composite:interface>


    <!-- IMPLEMENTATION -->
    <composite:implementation>
        <h:form id="new_fornecedor_form">

            <h:panelGrid columns="2">
                <h:outputText value="Nome/Razão social:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.name}" style="width: 450px" />

                <h:outputText value="Nome Fantasia:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.fantasia}" style="width: 450px" />

            </h:panelGrid>
            <h:panelGrid columns="4">
                <h:outputText value="CPF/CNPJ:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.cpf}" style="width: 200px" />

                <h:outputText value="RG/I.E.:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.rg}" style="width: 124px" />

                <h:outputText value="Tipo:" styleClass="formShortLabel"/>
                <p:selectOneMenu value="#{cc.attrs.cliente.tipo}" >
                    <f:selectItem itemLabel="Fisica" itemValue="Fisica" />
                    <f:selectItem itemLabel="Juridica" itemValue="Juridica" />
                </p:selectOneMenu>
                
                <h:outputText value="Sexo:" styleClass="formShortLabel"/>
                <p:selectOneMenu value="#{cc.attrs.cliente.sexo}" >
                    <f:selectItem itemLabel="Masculino" itemValue="Masculino" />
                    <f:selectItem itemLabel="Feminino" itemValue="Feminino" />
                </p:selectOneMenu>

                <h:outputText value="Data cadastro:" styleClass="formShortLabel"/>
                <p:calendar value="#{cc.attrs.cliente.dataCadastro}" style="width: 200px"/>

                <h:outputText value="Data Nascimento:" styleClass="formShortLabel"/>
                <p:calendar value="#{cc.attrs.cliente.dataNascimento}" style="width: 124px"/>

                <h:outputText value="email:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.email}" style="width: 200px" />

                <h:outputText value="Telefone:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.telefone}" style="width: 124px" />
            </h:panelGrid>

             <h:panelGrid columns="2">
                <h:outputText value="Endereço:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.endereco}" style="width: 450px" />
             </h:panelGrid>

             <h:panelGrid columns="4">
                <h:outputText value="Bairro:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.bairro}" style="width: 200px" />

                <h:outputText value="Cidade:" styleClass="formShortLabel"/>
                <p:autoComplete value="#{cc.attrs.cliente.cidade}"
                                completeMethod="#{autoCompleteBean.completeCidade}"
                                        var="c" itemLabel="#{c.name}" itemValue="#{c}"
                                        converter="cidadeConverter" style="width: 124px" />

                  <h:outputText value="CEP:" styleClass="formShortLabel"/>
                <p:inputText value="#{cc.attrs.cliente.cep}" style="width: 200px" />
                
             </h:panelGrid>
            <p:separator />
            <p:commandButton value="#{cc.attrs.buttonText}" action="#{cc.attrs.buttonAction}"
                             onclick="#{cc.attrs.onclick_sair_javascript}" update="#{cc.attrs.onclick_button_update}" />
        </h:form>
    </composite:implementation>
</html>


